<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>props</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <my-component :msg="message"></my-component>
    </div>

    <script type="text/javascript">
        Vue.component('my-component', {
            // ... 选项 ...
            props: ['msg'],//接受父级传递的数据
            template: '<div>{{ msg }}</div>'
        });

        var app = new Vue({
            el: '#app',
            data: {
                message: 'app 这是一个实例'
            }
        });
    </script>
</body>

</html>